import {
	wxRequest
} from "./request"
// 暴露所有api地址
// 生产环境 
const dev = "http://127.0.0.1:8123"
// 正式环境
// const pro = "http://47.107.105.42:7010"
// 测试环境 
const ngrok = ""
// socket地址
const socketAddr = ""
// 现在环境属于生产环境（上线修改该环境）
const BASEURL = dev
module.exports = {
	// 微信登录
	wxLogin: (code) => {
		return wxRequest(BASEURL + "/wxLogin", "POST", {
			wxcode: code
		})
	},
	// 微信注册
	wxRegister: (data) => {
		let {
			avatar,
			nickName,
			code
		} = data
		return wxRequest(BASEURL + "/wxRegister", "POST", {
			avatar,
			nickName,
			wxcode: code
		})
	},
	// 文件上传 
	uploadFile(TemFile) {
		wx.uploadFile({
			filePath: TemFile,
			fileName: fileName,
			// fileName: fileName,
			name: "file",
			avatar: fileName,
			url: BASEURL + "/files/upload/",
			success: (res) => {
				console.log(res)
				resolve(res)
			},
			fail: (err) => {
				console.log(err)
				reject(err)
			}
		})
	},
	// 手机号登录
	phoneLogin: (phone, code) => {
		return wxRequest(BASEURL + "/phoneLogin", "POST", {
			phone,
			code
		})
	},
	// 查询包裹
	getAllPackage() {
		return wxRequest(BASEURL + "/wx/getAllPackage")
	},
	// 取件快递
	finishPackage(id) {
		return wxRequest(BASEURL + "/wx/finishPackage", "POST", {
			id
		})
	}
}